package com.stars.system.reim.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.utils.DateUtils;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 报销记录 统计
 *
 * @author shuaibizhe
 * @date 2023-01-16
 */
public class ReimDailyStatInfo extends BaseEntity {

    private static final long serialVersionUID = 1L;

    /** 交通费 */
    private BigDecimal trafficAmount;

    /** 餐费 */
    private BigDecimal mealAmount;

    /** 总额 */
    private BigDecimal totalAmount;

    /** 记录数量 */
    private Integer recordCount;

    /** 缺少支付截图的记录数 */
    private Integer missImg;

    /** 报销人 */
    private String spender;

    /** 统计开始日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "统计开始日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date beginDate;

    /** 统计结束日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "统计结束日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date endDate;

    public BigDecimal getTrafficAmount() {
        return trafficAmount;
    }

    public BigDecimal getMealAmount() {
        return mealAmount;
    }

    public BigDecimal getTotalAmount() {
        return totalAmount;
    }

    public Integer getRecordCount() {
        return recordCount;
    }

    public Integer getMissImg() {
        return missImg;
    }

    public String getSpender() {
        return spender;
    }

    public Date getBeginDate() {
        return beginDate;
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setTrafficAmount(BigDecimal trafficAmount) {
        this.trafficAmount = trafficAmount;
    }

    public void setMealAmount(BigDecimal mealAmount) {
        this.mealAmount = mealAmount;
    }

    public void setTotalAmount(BigDecimal totalAmount) {
        this.totalAmount = totalAmount;
    }

    public void setRecordCount(Integer recordCount) {
        this.recordCount = recordCount;
    }

    public void setMissImg(Integer missImg) {
        this.missImg = missImg;
    }

    public void setSpender(String spender) {
        this.spender = spender;
    }

    public void setBeginDate(Date beginDate) {
        this.beginDate = beginDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public ReimDailyStatInfo() {
        this.mealAmount = new BigDecimal(0);
        this.trafficAmount = new BigDecimal(0);
        this.totalAmount = new BigDecimal(0);
        this.missImg = 0;
        this.recordCount = 0;
        this.beginDate = null;
        this.endDate = null;
    }

    public void sumStat(ReimDailyStatInfo reimStat) {
        this.mealAmount = this.mealAmount.add(reimStat.getMealAmount());
        this.trafficAmount = this.trafficAmount.add(reimStat.getTrafficAmount());
        this.totalAmount = this.totalAmount.add(reimStat.getTotalAmount());
        this.missImg += reimStat.missImg;
        this.recordCount += reimStat.recordCount;
        this.beginDate = DateUtils.getBeforeDate(reimStat.getBeginDate(), this.beginDate);
        this.endDate = DateUtils.getLatterDate(reimStat.getEndDate(), this.endDate);
        this.spender = "总计";
    }
}
